package edu.indiana.d2i.ontology.util;

import com.hp.hpl.jena.graph.query.Expression.Constant;
import com.hp.hpl.jena.ontology.ObjectProperty;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;

@SuppressWarnings("unused")
public class OntModelUtil {
	public static OntModel createOntModel() {
		OntModel model = com.hp.hpl.jena.rdf.model.ModelFactory
				.createOntologyModel();
		model.setNsPrefix("ifri",
				"http://www.semanticweb.org/ontologies/2011/3/Ontology1303230739450.owl#");
		
		// create three top classes
		OntClass main = model.createClass(Constants.MAIN_CLASS);
		OntClass relations = model.createClass(Constants.RELATIONSHIPS_CLASS);
		OntClass subcomponent = model.createClass(Constants.SUBCOMPONENTS_CLASS);
		
		// create the object properties
		ObjectProperty hascomponent = model.createObjectProperty(Constants.HAS_COMPONENT);
		ObjectProperty hasrelation = model.createObjectProperty(Constants.HAS_RELATIONSHIP);
		ObjectProperty haspart = model.createObjectProperty(Constants.HAS_PART);
		
		// create second level classes
		OntClass forest = model.createClass(Constants.FOREST_CLASS);
		OntClass forestPlot = model.createClass(Constants.FOREST_PLOT_CLASS);
		OntClass forestPlotComponent = model.createClass(Constants.FOREST_PLOT_COMPONENT_CLASS);
		
		// create third level classes
		OntClass gcover = model.createClass(Constants.GCOVER_CLASS);
		OntClass shrubsappling = model.createClass(Constants.SHRUBS_SAPPLINGS_CLASS);
		OntClass treeSample = model.createClass(Constants.TREE_SAMPLE_CLASS);
		
		// bind second level classes to top level ones
		main.addSubClass(forest);
		main.addSubClass(forestPlot);
		subcomponent.addSubClass(forestPlotComponent);
		
		// bind third level classes to second level ones
		forestPlotComponent.addSubClass(gcover);
		forestPlotComponent.addSubClass(shrubsappling);
		forestPlotComponent.addSubClass(treeSample);
		
		return model;
	}
}
